#ifndef __WORK_H__
#define __WORK_H__
#include <iostream>
#include <string>
#include <memory>
#include "state.h"
class Work : public std::enable_shared_from_this<Work>
{
public:
    using ptr = std::shared_ptr<Work>;
    Work()=delete;
    Work(double hour, bool finished) : m_hour(hour), m_finished(finished)
    {
        m_state = std::make_shared<MorningState>();
    }
    void startWork()
    {m_state->update(shared_from_this());}
    void setState(State::ptr state) { m_state = state; }
    State::ptr getState() { return m_state; }
    void setHour(double hour) { m_hour = hour; }
    double getHour() { return m_hour; }
    void setFinished(bool finished) { m_finished = finished; }
    bool getFinished() { return m_finished; }

private:
    State::ptr m_state;
    //判断如何进行状态转换
    double m_hour;
    bool m_finished;
};
#endif